<?php

use yii\helpers\Html;
use yii\grid\GridView;

/* @var $this yii\web\View */
/* @var $searchModel app\models\AccProjectSearch */
/* @var $dataProvider yii\data\ActiveDataProvider */

$this->title = 'Các thành viên tham gia dự án';
//$this->params['breadcrumbs'][] = $this->title;
?>
<div class="acc-project-index">

    <h1><?= Html::encode($this->title) ?></h1>
    <?php // echo $this->render('_search', ['model' => $searchModel]); ?>

    <!--
	<p>
        <?= Html::a('Create Acc Project', ['create'], ['class' => 'btn btn-success']) ?>
    </p>
	-->

    <?= GridView::widget([
        'dataProvider' => $dataProvider,
        'filterModel' => $searchModel,
        'columns' => [
            ['class' => 'yii\grid\SerialColumn'],

            //'id',
            //'acc_id',
            //'project_id',
			'user.username',
			'user.full_name',
			'project.name',	
            ['class' => 'yii\grid\ActionColumn',
				'template' => '{view} {delete}',],
				
            ['class' => 'yii\grid\ActionColumn',
				'template' => '{work-account}',
				'buttons' => [
					'work-account' => function ($url, $model) {
						return Html::a('DS tài khoản làm việc', $url);
					},
				],
				'urlCreator' => function ($action, $model, $key, $index) {
					if ($action === 'work-account') {
						$url =  Yii::$app->UrlManager->createUrl(['/work-account/index/', 'acc_pro_id'=>$model->id]);
						return $url;
					}
				}
			],
        ],
    ]); ?>

</div>
